<?php
/* @var $this UserBackController */
/* @var $model UserBack */
/* @var $form CActiveForm */
?>

<?php $form = $this->beginWidget('CActiveForm', array(
    'id' => 'user-back-form',
    'enableAjaxValidation' => false,
    'htmlOptions' => array(
        'role' => 'form',
        'class' => 'form-horizontal',
    )
)); ?>

<p class="note">Fields with <span class="required">*</span> are required.</p>

<?php if ($model->getErrors()) {
    ?>
    <div class="alert alert-error">
        <button class="close" data-dismiss="alert" type="button"> ×</button>
        <?php echo $form->errorSummary($model); ?>
    </div>
<?php } ?>
<div class="form admin-main-wrapper">
    <div class="block block-themed block-last">
        <div class="block-title">
            <h4></h4>
        </div>
        <div class="block-content">
            <div class="row control-group">
                <?php echo $form->labelEx($model, 'user_name', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'user_name', array('size' => 60, 'maxlength' => 127)); ?>
                </div>
            </div>

            <?php if ($model->isNewRecord) { ?>
                <div class="row control-group">
                    <?php echo $form->labelEx($model, 'password', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->passwordField($model, 'password', array('size' => 60, 'maxlength' => 100)); ?>
                    </div>
                </div>
            <?php } ?>


            <div class="row control-group">
                <?php echo $form->labelEx($model, 'first_name', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'first_name', array('size' => 60, 'maxlength' => 127)); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'last_name', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'last_name', array('size' => 60, 'maxlength' => 127)); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'sex', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->dropDownList($model, 'sex', array('0' => 'Nữ', '1' => 'Nam')); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'birthday', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'birthday', array('id' => 'ddlBirthday')); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'email', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'email', array('size' => 60, 'maxlength' => 127)); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'address', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'address', array('size' => 60, 'maxlength' => 255)); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'phone', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'phone', array('size' => 60, 'maxlength' => 127)); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'group_code', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->dropDownList($model, 'group_code', array('admin' => 'admin', 'editor' => 'editor', 'user' => 'user')); ?>
                </div>
            </div>

            <div class="row control-group">
                <?php echo $form->labelEx($model, 'website', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->checkBox($model, 'website', array('size' => 60, 'maxlength' => 255)); ?>
                </div>
            </div>
            <div class="row control-group">
                <?php echo $form->labelEx($model, 'status', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->checkBox($model, 'status'); ?>
                </div>
            </div>

            <div class="row control-group buttons">
                <div class="controls">
                    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn btn-default')); ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->endWidget(); ?>

<script type="text/javascript">
    $(document).ready(function () {
        $("#ddlBirthday").datepicker({
            yearRange: "-80:+0", // this is the option you're looking for
            showOn: "both",
            changeYear: true,
            changeMonth: true,
            dateFormat: "yy-mm-dd"
        });
    });
</script>
